<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // ^表示开始
        console.log(/^\d/.test('a123'));//false
        // $表示结束
        console.log(/\d$/.test('as123'));//true
        // 一般验证字符串合法性时  都会指定开始与结束
        console.log(/^\d{9}$/.test('122122122'));//true
    </script>
</body>
</html>